<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>人才培训</title>
	<meta name="format-detection" content="telephone=no">
	<meta name="viewport" content="minimal-ui=yes,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<meta name="msapplication-tap-highlight" content="no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">

	<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
	<link rel="stylesheet" type="text/css" href="css/public.css">
	<link rel="stylesheet" type="text/css" href="css/my_course.css">
	
</head>
<body>
	<div class="header">
		<div class="top">
			<div class="sn-nav-title of">我的课程</div>
		</div>
	</div>
	<div class="main">
		<div class="header">
			<p class="current"><a href="my_course.html">未考课程</a></p>
			<p><a href="my_course1.html">已考课程</a></p>
		</div>
		<div class="list">
			<ul id="items">
				
			</ul>
		</div>
	</div>
</body>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/base.js"></script>

<script type="text/javascript" charset="utf-8">
	var openid="";
	var hash=window.location.hash;
	if(hash==""){
		openid=localStorage.getItem("openid");
		if(openid==null || openid==''){
			alert("非法访问");
			window.close();			
		}
		loadData(openid);
	}else{
		if(hash.split("#")[0]==""){
			openid=hash.split("#")[1];

			loadData(openid);
		}
	}
	
	function loadData(openid){
		$.ajax({
			url  : "/course/select/openid",
			type : "post",
			data : {
				remark:openid,
				state:'success'
			},
				dataType : "json",
			async : false,
			success : function(data) {
				if(data.code==0){
					var list=data.data;
					var html="";
					for(var i=0;i<list.length;i++){
						html+="<li class='course clearfix'>"+
								  "<div class='left fl'>"+
									"<img src='img/course_logo.png' style='height: 80px;'>"+
								  "</div>"+
								  "<div class='right fr'>"+
									"<h3>"+list[i].title+"</h3>"+
									"<button class='courseBtn1' data_href='"+list[i].url+"' style='width: 100px;margin: 10px 0;'>查看内容</button>"+
									"<button class='courseBtn2' style='width: 100px;margin: 10px 5px;'>在线考试</button>"+
								  "</div>"+
							  "</li>";		
							  
					}
					$("#items").empty().append(html);
				}
			}
		});			
	}
	
	$(".courseBtn1").click(function(){
		var url=$(this).attr("data_href");
		window.open(url);
	});

	$(".courseBtn2").click(function(){
		alert("调用异常");
		return false;
		window.location.href="questions.html";
	})	
</script>


</html>